<template>
  <div class="home">
    <div class="user">
      <van-row gutter="20">
          <van-col span="5">
          <img class="user-icon" :src="user.icon" alt="">
        </van-col>
        <van-col span="14">
           <h3 class="user-name">{{user.name}}</h3>
           <p class="user-sign">{{user.sign}}</p>
           <van-row gutter="0">
              <van-col span="8">关注 <span>{{attention}}</span></van-col>
              <van-col span="8">粉丝 <span>{{fans}}</span></van-col>
              <van-col span="8">获赞 <span>{{huozan}}</span></van-col>
          </van-row>
        </van-col>
        <van-col span="5">
          <router-link to="/myhome">
            <van-tag color="#fafafa" text-color="#ad0000" >个人主页</van-tag>
          </router-link>
        </van-col>
      </van-row>
      <van-row gutter="0">
        <van-col span="6">
          <van-row>
           <router-link to="/myHome" >
              <van-col span="18">
                <h5>帖子</h5>
                <p>我发布的</p>
              </van-col>
            </router-link>
            <van-col span="6">
              <img src="../assets/img/file.png" alt="">
            </van-col>
          </van-row>
        </van-col>
        <van-col span="6">
          <van-row>
            <router-link to="/myHome" :tab_id="2">
              <van-col span="18">
                <h5>评论</h5>
                <p>我发出的</p>
              </van-col>
            </router-link>
            <van-col span="6">
              <img src="../assets/img/comment.png" alt="">
            </van-col>
          </van-row>
        </van-col>
        <van-col span="6">
          <van-row>
            <van-col span="18">
              <h5>插眼</h5>
              <p>期待后续</p>
            </van-col>
            <van-col span="6">
              <img src="../assets/img/eye.png" alt="">
            </van-col>
          </van-row>
        </van-col>
        <van-col span="6">
          <van-row>
            <van-col span="18">
              <h5>收藏</h5>
              <p>我的最爱</p>
            </van-col>
            <van-col span="6">
              <img src="../assets/img/collect.png" alt="">
            </van-col>
          </van-row>
        </van-col>
      </van-row>
    </div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item>
        <img src="../assets/img/v.png" alt="">
      </van-swipe-item>
      <van-swipe-item>
        <img src="../assets/img/gongyue.jpeg" alt="">
      </van-swipe-item>
      <van-swipe-item>
        <img src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-15a29732-5b04-46d4-9295-f64cf3846386/fa5e0a15-6780-43ce-bd87-0845af176335.jpg" alt="">
      </van-swipe-item>
    </van-swipe>
    <van-cell is-link title="历史记录" @click="show = false" />
    <p class="gengduo">更多功能</p>
    <van-grid>
      <van-grid-item icon="setting-o" text="设置" to="/set" />
      <van-grid-item icon="warning-o" @click="showPopup" text="意见反馈" />
      <van-popup v-model="show" round position="bottom" :style="{ height: '30%' }" >
       <p class="hint">联系我们</p> 
       <p class="phone"><van-icon name="phone-o"/>电话</p>
       <p class="phone-num">400-820-8820</p>
      </van-popup>
      <van-grid-item icon="award-o" text="神评鉴定 " />
      <van-grid-item icon="balance-pay" text="我的钱包" />
      <van-grid-item icon="cart-circle-o" text="社区商城" />
      <van-grid-item icon="music-o" text="音乐天地" />
      <van-grid-item icon="award-o" text="神评鉴定 " />
      <van-grid-item icon="apps-o" text="更多" />
    </van-grid>
    <tab-btn></tab-btn>
  </div>
</template>

<script>
import tabBtn from "../components/tabBtn";
import axios from 'axios';

export default {
  data() {
    return {
      user:{
        icon:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.17qq.com%2Fimg_qqtouxiang%2F87511483.jpeg&refer=http%3A%2F%2Fwww.17qq.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1623313760&t=bddd032f9a2982c432f2f52bc3eba9b3',
        name:'请登录',
        sign:'这里什么都没有', 
      },
      fans:'-',
      attention:'-',
      huozan:'-',
      show: false,
    };
  },
  components: {
    tabBtn,
  },
  methods:{
      showPopup() {
      this.show = true;
    },
  },
  created() {
    let user_id=localStorage.getItem('user_id')
    axios.get("http://localhost:3000/get_user",{
        params:{
         id:user_id
        } 
      })
      .then(res=>{
        // console.log(res);
        res=res.data.data
        this.user=res.userlist[0]
        this.fans=res.fans
        this.attention=res.attention
        this.huozan=res.huozan       
      });
  },
};
</script>

<style lang="less" scoped>
.user-icon{
  width: 80px;
  height: 80px;
  border-radius: 50%;
  color: rgb(243, 236, 236);
}
.user-name{
  margin: 0;
  padding-left: 10px;
  font-size: 18px;
}
.user-sign{
  margin: 0;
  margin-top: 5px;
  color: rgb(184, 180, 180);
  font-size: 10px;
  padding-left: 10px;
}
a{
  color: black;
}
/deep/ .van-row:nth-child(1){
  margin: 0;
  padding: 30px 0px 10px 10px;
  .van-row{
    padding: 15px 0 10px 10px;
    font-size: 12px;
    font-family: icon;
    span{
      font-weight: bold;
    }
  }
}
/deep/ .van-row:nth-child(2){
  padding: 5px;
  .van-col{
    .van-row{
      border-radius: 5px;
      border: 2px solid rgb(248, 247, 247);
      background: rgb(255, 255, 255);
      padding:5px;
      margin: 5px;
      p{
        padding: 0;
        margin: 0;
        font-size: 12px;
        font-family: sans-serif;
      }
      h5{
        padding: 0;
        margin: 0;
      }
      img{
        position: relative;
        right: 8px;
        bottom: -13px;
        opacity: 0.3;
        width: 32px;
        height: 32px;
      }
    }
  
  }
}
/deep/ .van-swipe{
  margin: 10px;
  img{
    width: 100%;
    height: 150px;
    border-radius: 20px;
  }
}
.gengduo{
    display: flex;
    box-sizing: border-box;
    width: 100%;
    padding: 10px 16px;
    overflow: hidden;
    color: #323233;
    font-size: 14px;
    line-height: 24px
}
/deep/.van-grid{
  margin-bottom: 50px;
}
.hint{
  text-align: center;
  color: #ff7373;
}
.phone{
  text-align: center;
  padding: 5px;
  margin: 20px;
  color: #626568;
}
.phone-num{
  text-align: center;
  color: #626568;
}
</style>
